package com.example.booksystem.controller;

import com.example.booksystem.model.Book;
import com.example.booksystem.service.impl.BookImpl;

import java.sql.SQLException;
import java.util.List;

public class BookController {
    public List<Book> search(String text) throws SQLException {
        return new BookImpl().selectBook(text);
    }

    public List<Book> getAllBook() throws SQLException {
        return new BookImpl().selectAllBook();
    }

    public Boolean delete(Book book)throws SQLException {
        return new BookImpl().deleteBook(book);
    }

    public Boolean update(Book book) throws SQLException{
        return new BookImpl().updateBook(book);
    }

    public Boolean borrow(Book book,Integer userId) throws SQLException{
        return new BookImpl().borrowBook(book,userId);
    }

    public Boolean insert(Book book) throws SQLException{
        return new BookImpl().insertBook(book);
    }
    public List<Book> selectBorrowBook(Integer userId)throws SQLException{
        return new BookImpl().selectBorrowBook(userId);
    }
    public Boolean returnBook(Integer userId,String bookId)throws SQLException{
        return new BookImpl().returnBook(userId,bookId);
    }
}
